<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>Jdong文件管理系统</title>
</head>
<body>
    <h1>Jdong File Server</h1>
    <div>
        <form th:method="post" enctype="multipart/form-data" th:action="@{/upload}">
            <table>
                <tr>
                    <td>Upload the file:</td>
                    <td>
                        <input type="file" name="logofile" accept="image/png,image/gif,image/jpeg"/>
                    </td>
                    <td>
                        <input type="submit" value="Upload"/>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </table>
        </form>
    </div>
    <div>
        <table border="1" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <td>Name</td>
                    <td>ID</td>
                    <td>contentType</td>
                    <td>size</td>
                    <td>uploadDate</td>
                    <td>md5</td>
                    <td>preview</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody>
                <tr th:if="${files.size()} eq 0">
                    <td colspan="3">没有文件信息!!</td>
                </tr>
                <tr th:each="file : ${files}">
                    <td><a th:href="|/view/*{file.id}|" th:text="${file.name}"></a></td>
                    <td th:text="${file.id}"></td>
                    <td th:text="${file.contentType}"></td>
                    <td th:text="${file.size}"></td>
                    <td th:text="${file.uploadDate}"></td>
                    <td th:text="${file.md5}"></td>
                    <td><img th:src="|/view/*{file.id}|" width="100px" height="20px"></td>
                    <td>
                        <a th:href="@{/delete(id=*{file.id})}" th:text="删除" onclick="return confirm('确定删除吗?')"></a>
                        <a th:href="@{/update(id=*{file.id})}" th:text="修改"></a>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</body>
</html>